package com.whf.android.jar.constants.business;

import com.whf.android.jar.constants.BaseEnum;

import java.util.Objects;


/**
 * 是否的枚举类型
 *
 * @author qf
 * @version 1.0.1
 */
public enum YesOrNoEnum implements BaseEnum<Integer> {

    YES(1, "是"),
    NO(2, "否");


    private final int value;
    private final String esc;

    YesOrNoEnum(int value, String esc) {
        this.value = value;
        this.esc = esc;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    @Override
    public String getDesc() {
        return esc;
    }

    @Override
    public boolean isExists(Integer value) {
        for (YesOrNoEnum e : YesOrNoEnum.values()) {
            if (Objects.equals(e.getValue(), value)) {
                return true;
            }
        }
        return false;
    }

    @Override
    public String value2Desc(Integer value) {
        if (Objects.equals(YES.getValue(), value)) {
            return YES.getDesc();
        }
        return NO.getDesc();
    }
}
